﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;

namespace LoungeWare
{
    class MovieCopy : BackgroundWorker
    {
        private List<string> m_lFiles;
        private string m_sPath;

        #region Ctror / DoWork
        public MovieCopy(List<string> lFiles, string sPath)
        {
            m_lFiles = lFiles;
            m_sPath = sPath;
        }

        protected override void OnDoWork(DoWorkEventArgs e)
        {
            int nCount = 0;
            foreach (string sMovie in m_lFiles)
            {
                MovieExplorer.Instance.SetStatusLabel(String.Format("Copying {0}...", sMovie));
                MovieExplorer.Instance.SetStatusProgress(++nCount, m_lFiles.Count);
                try
                {
                    FileInfo fi = new FileInfo(sMovie);
                    System.IO.File.Copy(sMovie, m_sPath + "\\" + fi.Name);
                }
                catch (System.IO.IOException)
                {
                    //eat it
                }
            }
//            base.OnDoWork(e);
        }

        #endregion
    }
}
